package me.keiwu.user.controller.pub;

import com.alibaba.fastjson.JSONObject;
import me.keiwu.pub.data.ResponseV2;
import me.keiwu.pub.util.CacheUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by kei on 03/01/2018.
 */
@RestController
@RequestMapping("/pub/donate")
public class DonatePubController {



    private Logger logger = LoggerFactory.getLogger(DonatePubController.class);


    @Autowired
    private CacheUtil cacheUtil;

    @RequestMapping("/data")
    public ResponseV2 getDonateData() {
        logger.info("getDonateData in user service");
        JSONObject json = new JSONObject();
        json.put("totalSteps", cacheUtil.getTotalDonateSteps());
        json.put("totalUsers", cacheUtil.getTotalDonateUsers());
        return ResponseV2.ok(json);
    }

}
